﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Maticsoft.Common;

namespace lcmyjobs.Web.users
{
    public partial class subscription : BasePage
    {
        lcmyjobs.BLL.user_basic bub = new BLL.user_basic();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                this.Title = string.Format("人管理中心—职位搜索：职位订阅   {0}", Application["webname"].ToString());
                if (Session["user_id"] != null)
                {
                    int id = int.Parse(Session["user_id"].ToString());
                    this.lblName.Text = Session["user_name"].ToString();
                    show(id);
                }
                else
                {
                    Response.Redirect("userlogin.html");
                }
            }

        }
        protected void show(int id)
        {
            int i = bub.GetSubscription(id);
            if (i == 1)
            {
                rbt1.Checked = true;
                rbt0.Checked = false;
            }

        }

        protected void Button1_Click(object sender, EventArgs e)
        {

            int i = 0;
            if (rbt1.Checked) i = 1;
            int r = bub.changeSubscription(Convert.ToInt32(Session["user_id"]), i);
            if (r != 0)
            {
                Maticsoft.Common.MessageBox.Show(this, "修改成功！");
            }
            else
                Maticsoft.Common.MessageBox.Show(this, "修改失败！");
        }
        
    }
}